package com.ocm.core.domain;

import com.ocm.core.exception.ExceptionCode;
import com.ocm.core.exception.TypeCodeException;
import com.ocm.core.exception.UnsupportTypeException;

public enum UserDetailType {
   USER(0), GROUP(1);

   private int type;

   private UserDetailType(int type) {
      this.type = type;
   }

   public static UserDetailType getUserDetailType(int type) throws UnsupportTypeException {
      UserDetailType result = null;
      switch (type) {
      case 0:
         result = USER;
         break;
      case 1:
         result = GROUP;
         break;
      default:
         throw new UnsupportTypeException(ExceptionCode.instance(TypeCodeException.class,
               TypeCodeException.CLASSDEF));
      }
      return result;
   }

   public int getType() {
      return type;
   }
}
